<template>
    <rx-dialog @handOk="handleSubmit" @cancel="cancel">
        <rx-layout>
            <div slot="header"  >
                <div class="table-page-search-wrapper" border="false">
                    <a-form layout="inline">
                        <a-row :gutter="24">
                            <a-col  :span="8">
                                <a-form-item :label="$ti18('rxForm.name','名称')">
                                    <a-input :placeholder="$ti18('rxForm.name','名称')" v-model="queryParam.Q_NAME__S_LK"/>
                                </a-form-item>
                            </a-col>
                            <a-col  :span="8">
                                <a-form-item :label="$ti18('rxForm.rxAlias', '别名')">
                                    <a-input :placeholder="$ti18('rxForm.rxAlias', '别名','','input')" v-model="queryParam.Q_ALIAS__S_EQ"/>
                                </a-form-item>
                            </a-col>
                            <a-col  :span="8">
                              <span class="table-page-search-submitButtons">
                                <a-button type="primary" @click="$refs.table.loadData()" icon="search">{{$ti18('rxList.searchBtn','查询')}}</a-button>
                                <a-button style="margin-left: 4px" @click="resetSearch">{{$ti18('rxList.resetBtn','重置')}}</a-button>
                              </span>
                            </a-col>
                        </a-row>
                    </a-form>
                </div>
            </div>
            <div slot="center" style>
                <rx-grid
                    ref="table"
                    :allowRowSelect="true"
                    :multiSelect="false"
                    :columns="columns"
                    :defaultPageSize="10"
                    url="/api-screen/screen/core/screenChartManage/query"
                    :queryParam="queryParam"
                    data-field="result.data"
                    :pageSizeOptions="['10','30','40']"
                    id-field="id"
                    @selectChange="onSelectChange"
                >
                    <span slot="name" slot-scope="{text, record}">
                        {{$i18(text)}}
                    </span>
                </rx-grid>
            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>

import FormCalendarViewApi from '@/api/form/core/formCalendarView'
import {BaseList, RxFit, RxGrid, Util} from "@lowcode/jpaas-common-lib";

export default {
    name: 'ScreenChartDialog',
    mixins: [BaseList],
    components: {
        RxFit,
        RxGrid
    },
    props: {
        layerid: {
            type: String,
            default: ""
        },
        destroy: {
            type: Function
        },
    },
    data() {
        return {
            columns: [
                {
                    title: this.$ti18('rxList.index','序号'),
                    type: 'indexColumn',
                    width: 50,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {title: this.$ti18("rxForm.name", "名称"),dataIndex: 'name', width: 100,scopedSlots: {customRender: 'name'}},
                {title: this.$ti18('rxForm.alias', '别名'), dataIndex: 'alias', width: 100},
                {title: this.$ti18('rxForm.createTime','创建时间'), dataIndex: 'createTime', width: 100}
            ]
        }
    },
    created() {
        this.needFilterAppId();
    },
    methods: {
        getListByParams(parameter) {
            return FormCalendarViewApi.query(parameter)
        },
        search() {
            this.$refs.table.loadData()
        },
        handleSubmit(vm) {
            if(this.selectedRows.length==0){
                this.$message.warning("请选择至少一个");
                vm.loading=false;
                return;
            }
            Util.closeWindow(this,"ok",this.selectedRows[0])
        },
        cancel() {
            Util.closeWindow(this,"cancel")
        },
    }
}
</script>
<style scoped>

</style>

